www.gusucode.com > 基于马尔科夫随机场的图像分割matlab源码。包括ICM迭代条件模式求解最大后验概率算法 > code23/matlab MRF toy examples/utIf.m

    
function val = utIf(bool, val1, val2)

% utIf: functional "if" statement
%
%  X = utIf(Y, A,B) returns A if Y is true (nonzero), and B otherwise.
%  This is basically the much-loved "?:" operator that you find in C++.
%

if (bool) val = val1;
     else val = val2; end;